how to use char* as char[]

Posted by phunehehe on Stack Overflow See other posts from Stack Overflow or by phunehehe
Published on 2010-04-17T11:29:19Z Indexed on 2010/04/17 11:33 UTC
Read the original article Hit count: 297

Filed under:
|
|
|

Hello, I have a struck like this

typedef struct bookStruct
{
   char title[80];
   char author[80];
} BookType;

And I have two strings like this

char *title = "A Book on C";
char *author = "A. Kelly";

Now I can't create a BookType like this

BookType book = {title, author};

Can anyone tell me what is wrong? How can I do that?

© Stack Overflow or respective owner

Related posts about c

    Related posts about string